# x = 10
#
#
# def test():
#     x = 20
#     print(x)
#
#
# test()
# print(x)

# x = 10
#
#
# def test():
#     # 改变全局使用global
#     global x
#     x = 20
#
#
# test()
# print(x)
# # 只有函数，类的变量是局部的
# for i in range(1, 11):
#     print(i)
#
# print(i)
#
# if True:
#     b = 20
# print(b)

# 调试
# def test():
#     print("函数")
#
#
# print("1")
# test()
# print("2")
# test()
# print("3")
# test()

# 链式调用
def isOdd(x):
    if x % 2 == 0:
        return False
    return True


def add(x, y):
    return x + y


print(isOdd(add(5, 5)))

# 嵌套 局部变量 函数栈帧
def a():
    a1 = 10
    print("a")


def b():
    b1 = 20
    print("b")
    a()


def c():
    c1 = 100
    print("c")
    b()


def d():
    d1 = 1000
    print("d")
    c()


d()
